/******************************************************************************
 * * cale_ui.c - implementation of calendar ui
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#include "cale_global.h"

LV_IMG_DECLARE(calendar);

/**
 * Common Process UI destroy event
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_Common_Destory(VOID *pDesc)
{
    Hal_Mem_Free(pDesc);
    g_CalendarMng.CurrentDesc = NULL;
}

/**
 * Common Process UI save event
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_Common_Save(VOID *pDesc)
{
    g_CalendarMng.CurrentDesc = NULL;
}

/**
 * Common Process UI restore event
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_Common_Restore(VOID *pDesc)
{
    g_CalendarMng.CurrentDesc = pDesc;
}

/**
 * display timer timeout call back function
 * param (in) Para: UINT32
 * return  void
 */
VOID Cale_Display_Timeout(VOID* Para)
{
    g_CalendarMng.StatusTimer = NULL;

    printf("%s: actid %d\n", __FUNCTION__, g_CalendarMng.ForwardActId);
    switch (g_CalendarMng.ForwardActId)
    {
    case ACT_ID_CALENDAR_REMINDER_DELETED:
    {
        printf("%s: reminder deleted, process %d\n", __FUNCTION__, g_CalendarMng.Process);
        if (UI_CALE_PROCESS_ADD_REMINDER == g_CalendarMng.Process)
        {
            if (NULL == _lv_ll_get_head(&g_CalendarMng.Reminder))
            {
                if (ACT_ID_CALENDAR_REMINDER_DELETED == Nav_Get_Top())
                {
                    Display_Calendar_Add_Reminder_Memory_Full_To_Empty();
                }
                else
                {
                    Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR_ADD_REMINDER, NULL, NULL);
                }
            }
            else
            {
                Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR_VIEW_ALL, NULL, NULL);
            }
        }
        else if (UI_CALE_PROCESS_VIEW_TODAY == g_CalendarMng.Process)
        {
            if (NULL == _lv_ll_get_head(&g_CalendarMng.Reminder))
            {
                if (ACT_ID_CALENDAR_REMINDER_DELETED == Nav_Get_Top())
                {
                    Display_Calendar_Reminder_Memory_Empty();
                }
                else
                {
                    Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR, NULL, NULL);
                }
            }
            else if (UI_Cale_Is_On_Show_Reminder_Empty())
            {
                Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR, NULL, NULL);
            }
            else
            {
                Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR_VIEW_ALL, NULL, NULL);
            }
        }
        else if (UI_CALE_PROCESS_VIEW_ALL == g_CalendarMng.Process)
        {
            if (NULL == _lv_ll_get_head(&g_CalendarMng.Reminder))
            {
                if (ACT_ID_CALENDAR_REMINDER_DELETED == Nav_Get_Top())
                {
                    Display_Calendar_Reminder_Memory_Empty();
                }
                else
                {
                    Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR, NULL, NULL);
                }
            }
            else
            {
                Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR_VIEW_ALL, NULL, NULL);
            }
        }

        return;
    }

    case ACT_ID_CALENDAR_REMINDER_ADDED:
        printf("%s: reminder added, process %d\n", __FUNCTION__, g_CalendarMng.Process);
        if (UI_CALE_PROCESS_ADD_REMINDER == g_CalendarMng.Process)
        {
            Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR, NULL, NULL);
        }
        else
        {/*edit reminder for view all or view today process*/
            if ((g_CalendarMng.DayOnShow.year == g_CalendarMng.ReminderInOper->Info.Year)
                && (g_CalendarMng.DayOnShow.month == g_CalendarMng.ReminderInOper->Info.Mon)
                && (g_CalendarMng.DayOnShow.day == g_CalendarMng.ReminderInOper->Info.Day))
            {
                Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR_VIEW_ALL, NULL, NULL);
            }
            else
            {
                Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR, NULL, NULL);
            }
        }
        break;

    case ACT_ID_CALENDAR_REMINDER_MEMORY_EMPTY:
        Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR, NULL, NULL);
        break;

    case ACT_ID_CALENDAR_FOR_CHINESE:
    case ACT_ID_CALENDAR_DATE_PAST:
        Nav_Back(g_CalendarMng.ForwardActId);
        break;

    case ACT_ID_CALENDAR_REMINDER_DISCARDED:
    case ACT_ID_CALENDAR_ALARM_POSTPONED:
        if (g_CalendarMng.RingReminder)
        {
            Display_Calendar_Reminder_Alarm_Ring();
        }
        else
        {
            if (IF_FRAMEWORK_INIT_CHARGE == Framework_Get_Init_Type())
            {
                Framework_Poweroff_Stop_Alarm_Ind();
            }
            else
            {
                Nav_Back(g_CalendarMng.ForwardActId);
                Nav_Back(ACT_ID_CALENDAR_REMINDER_ALARM_RING);
            }
        }
        break;

    case ACT_ID_CALENDAR_ADD_REMINDER_MEM_FULL_TO_EMPTY:
        Nav_Forward(g_CalendarMng.ForwardActId, ACT_ID_CALENDAR_ADD_REMINDER, NULL, NULL);
        break;

    default:
        break;
    } /* switch */
}     /* Cale_Display_Timeout */

/**
 * On destroy for Cale_Status
 * param (in) Para: VOID *
 * return void
 */
VOID Cale_Status_On_Destroy(VOID *Para)
{
    if (g_CalendarMng.StatusTimer)
    {
        Hal_Timer_Stop(g_CalendarMng.StatusTimer);
        g_CalendarMng.StatusTimer = NULL;
    }
    Cale_Common_Destory(Para);
}

/**
 * display Cale_Status UI
 * common ui: UI_Status_Desc_t
 * param (in) void
 * return void
 */
VOID Display_Cale_Status(ACTIVITY_ID ActId)
{
    Nav_Func_List_t  FuncList = {};
    UI_Status_Desc_t *pDesc;

    FuncList.OnShow         = (Void_P_Func_t)UI_Status_Create;
    FuncList.OnDestroy      = Cale_Status_On_Destroy;
    FuncList.OnSaveState    = NULL;
    FuncList.OnRestoreState = NULL;

    pDesc = (UI_Status_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Status_Desc_t));
    memset(pDesc, 0, sizeof(UI_Status_Desc_t));

    /* set TxtId of Status UI */
    switch (ActId)
    {
    case ACT_ID_CALENDAR_FOR_CHINESE:
        pDesc->ContLabel.TxtId = PHONE_TEXT_ID_AVAILABLE_CH;
        pDesc->ContImg.Img     = LV_SYMBOL_WARNING;
        break;

    case ACT_ID_CALENDAR_DATE_PAST:
        pDesc->ContLabel.TxtId = PHONE_TEXT_ID_PAST;
        pDesc->ContImg.Img     = LV_SYMBOL_WARNING;
        break;

    case ACT_ID_CALENDAR_REMINDER_ADDED:
        pDesc->ContLabel.TxtId = PHONE_TEXT_ID_REMINDER_ADDED;
        pDesc->ContImg.Img     = LV_SYMBOL_OK;
        break;

    case ACT_ID_CALENDAR_REMINDER_DELETED:
        pDesc->ContLabel.TxtId = PHONE_TEXT_ID_REMINDER_DELETED;
        pDesc->ContImg.Img     = LV_SYMBOL_OK;
        break;

    case ACT_ID_CALENDAR_REMINDER_MEMORY_EMPTY:
    case ACT_ID_CALENDAR_ADD_REMINDER_MEM_FULL_TO_EMPTY:
        pDesc->ContLabel.TxtId = PHONE_TEXT_ID_REMINDER_MEMORY_EMPTY;
        pDesc->ContImg.Img     = LV_SYMBOL_WARNING;
        break;

    case ACT_ID_CALENDAR_ALARM_POSTPONED:
        pDesc->ContLabel.TxtId = PHONE_TEXT_ID_REMINDER_POSTP_10_MIN;
        pDesc->ContImg.Img     = LV_SYMBOL_WARNING;
        break;

    case ACT_ID_CALENDAR_REMINDER_DISCARDED:
        pDesc->ContLabel.TxtId = PHONE_TEXT_ID_REMINDER_DISCARDED;
        pDesc->ContImg.Img     = LV_SYMBOL_OK;
        break;

    default:
        break;
    }
    pDesc->ContLabel.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    pDesc->ContLabel.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pDesc->ContLabelAlign       = LV_ALIGN_IN_TOP_LEFT;
    pDesc->ContImgAlign         = LV_ALIGN_IN_TOP_RIGHT;

    pDesc->KeyFunc = NULL;

    Nav_Forward(ACT_ID_ANY, ActId, &FuncList, pDesc);

    g_CalendarMng.ForwardActId = ActId;
    g_CalendarMng.StatusTimer = Hal_Timer_Start(UI_CALENDAR_STATUS_DISPLAY_TIME_LEN,
                                                Cale_Display_Timeout,
                                                NULL,
                                                FALSE);
} /* Display_Cale_Status */

/**
 * Process On Restore event of Calendar
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Restore_Calendar(VOID *pDesc)
{
    UI_Calendar_Only_Desc_t *pTmpDesc;
    UINT8                   DateCnt;

    Cale_Common_Restore(pDesc);
    pTmpDesc = (UI_Calendar_Only_Desc_t *)pDesc;

    if (pTmpDesc->Calendar.HighlihtedDays)
    {
        Hal_Mem_Free(pTmpDesc->Calendar.HighlihtedDays);
    }
    pTmpDesc->Calendar.HighlihtedDays = UI_Cale_Get_Hightlighted_Dates(&DateCnt);
    lv_calendar_set_highlighted_dates(pTmpDesc->Calendar.Calendar,
                                      pTmpDesc->Calendar.HighlihtedDays,
                                      DateCnt);
}

/**
 * Process On Saved event of Calendar
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Save_Calendar(VOID *pDesc)
{
    UI_Calendar_Only_Desc_t *pTmpDesc;

    Cale_Common_Save(pDesc);

    pTmpDesc = (UI_Calendar_Only_Desc_t *)pDesc;
    pTmpDesc->Calendar.ShowedDate.year = g_CalendarMng.DayOnShow.year;
    pTmpDesc->Calendar.ShowedDate.month = g_CalendarMng.DayOnShow.month;
    pTmpDesc->Calendar.ShowedDate.day = g_CalendarMng.DayOnShow.day;
}

/**
 * Process On restore event of Calendar
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_Calendar(VOID *pDesc)
{
    UI_Calendar_Only_Desc_t *pTmpDesc;
    UINT8                   DateCnt;

    g_CalendarMng.CurrentDesc = pDesc;
    pTmpDesc                  = (UI_Calendar_Only_Desc_t *)pDesc;

    Hal_Mem_Copy(&(g_CalendarMng.DayOnShow),
                 lv_calendar_get_showed_date(pTmpDesc->Calendar.Calendar),
                 sizeof(lv_calendar_date_t));

    pTmpDesc->Calendar.HighlihtedDays = UI_Cale_Get_Hightlighted_Dates(&DateCnt);
    lv_calendar_set_highlighted_dates(pTmpDesc->Calendar.Calendar,
                                      pTmpDesc->Calendar.HighlihtedDays,
                                      DateCnt);
}

/**
 * Process On destroyed event of Calendar
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_Calendar(VOID *pDesc)
{
    UI_Calendar_Only_Desc_t *pTmpDesc;

    pTmpDesc = (UI_Calendar_Only_Desc_t *)pDesc;
    if (pTmpDesc->Calendar.HighlihtedDays)
    {
        Hal_Mem_Free(pTmpDesc->Calendar.HighlihtedDays);
    }
    Cale_Common_Destory(pDesc);
}

/**
 * Callback function for getting information of the showed date,
 * lunar date if chinese, current week if english
 * param (in) ShowedDate: lv_calendar_date_t
 * param (out) Output[]: INT8, size is 20
 * return  VOID
 */
VOID Cale_Get_Date_Info_Cb(lv_calendar_date_t *ShowedDate, INT8 Output[])
{
    if (UI_LANG_EN == lv_lang_act())
    {
        snprintf(Output, 20, "Week %d", UI_Cale_Get_Weeks(ShowedDate));
    }
    else
    {
        Output[0] = '\0';
        UI_Cale_Get_Lunar(ShowedDate, Output, NULL);
    }
}

/**
 * display Calendar main UI
 * common ui: UI_Calendar_Only_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar(VOID)
{
    Nav_Func_List_t         FuncList = { 0 };
    UI_Calendar_Only_Desc_t *pDesc;
    hal_rtc_t               CurrentTime;

    FuncList.OnShow         = UI_Calendar_Create;
    FuncList.OnCreate       = Cale_On_Create_Calendar;
    FuncList.OnDestroy      = Cale_On_Destroy_Calendar;
    FuncList.OnSaveState    = Cale_On_Save_Calendar;
    FuncList.OnRestoreState = Cale_On_Restore_Calendar;

    pDesc = (UI_Calendar_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Calendar_Only_Desc_t));
    memset(pDesc, 0, sizeof(UI_Calendar_Only_Desc_t));
    // set today info
    Hal_Rtc_Gettime(&CurrentTime);
    pDesc->Calendar.Today.day   = CurrentTime.tm_mday;
    pDesc->Calendar.Today.month = CurrentTime.tm_mon;
    pDesc->Calendar.Today.year  = CurrentTime.tm_year;

    pDesc->Calendar.ShowedDate.day   = CurrentTime.tm_mday;
    pDesc->Calendar.ShowedDate.month = CurrentTime.tm_mon;
    pDesc->Calendar.ShowedDate.year  = CurrentTime.tm_year;

    pDesc->Calendar.ShowedDateInfoCb = Cale_Get_Date_Info_Cb;

    pDesc->ButtonBar.ButtonL.Valid = TRUE;
    pDesc->ButtonBar.ButtonM.Valid = FALSE;
    pDesc->ButtonBar.ButtonR.Valid = TRUE;

    pDesc->ButtonBar.ButtonL.TxtId = PHONE_TEXT_ID_OPT;
    pDesc->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;
    pDesc->KeyFunc                 = Cale_Key_Proc_Calendar;

    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR, &FuncList, pDesc);
} /* Display_Calendar */

/**
 * Process On destroy event of Calendar
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_Cale_Option(VOID *pDesc)
{
    UI_Normal_List_Only_Desc_t *pTmpDesc;

    pTmpDesc = (UI_Normal_List_Only_Desc_t *)pDesc;
    Hal_Mem_Free(pTmpDesc->List.ButtonList);
    Cale_Common_Destory(pDesc);
}

/**
 * Process On Created event of cale option
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_Cale_Option(VOID *pDesc)
{
    g_CalendarMng.CurrentDesc = pDesc;
}

/**
 * Process On Save event of cale option
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Save_Cale_Option(VOID *pDesc)
{
    UI_Normal_List_Only_Desc_t *pTmpDesc;
    lv_obj_t                   *CurrentBtn;

    pTmpDesc = (UI_Normal_List_Only_Desc_t *)pDesc;

    // save index
    CurrentBtn           = lv_list_get_btn_selected(pTmpDesc->List.List);
    pTmpDesc->List.Index = lv_list_get_btn_index(pTmpDesc->List.List, CurrentBtn);
    Cale_Common_Save(pDesc);
}

/**
 * display Calendar option UI
 * common ui: UI_Normal_List_Only_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Option(VOID)
{
    Nav_Func_List_t            FuncList = { 0 };
    UI_Normal_List_Only_Desc_t *pDesc;
    UI_Button_Desc_t           *pList;
    UINT8                      ListBtnCnt;

    FuncList.OnShow         = UI_Normal_List_Only_Create;
    FuncList.OnCreate       = Cale_On_Create_Cale_Option;
    FuncList.OnDestroy      = Cale_On_Destroy_Cale_Option;
    FuncList.OnSaveState    = Cale_On_Save_Cale_Option;
    FuncList.OnRestoreState = Cale_Common_Restore;

    pDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    pDesc->TitleBar.TxtId    = PHONE_TEXT_ID_CALENDAR;
    pDesc->TitleBar.TxtAlign = LV_LABEL_ALIGN_CENTER;

    /* Add reminder */
    /* [View today] showed when reminder present on showed day*/
    /* [Reminder List] showed when reminder present */
    /* Go to date */
    /* Lunar calendar */

    ListBtnCnt = 3;

    if (FALSE == UI_Cale_Is_On_Show_Reminder_Empty())
    {   // reminders are present for select date
        ListBtnCnt++;
    }

    if (_lv_ll_get_head(&g_CalendarMng.Reminder))
    {   // has reminder
        ListBtnCnt++;
    }

    pList = (UI_Button_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Button_Desc_t) * ListBtnCnt);
    Hal_Mem_Set(pList, 0, sizeof(UI_Button_Desc_t) * ListBtnCnt);
    pDesc->List.ButtonList = pList;

    // Add reminder
    pList[pDesc->List.ListButtonCnt].Valid        = TRUE;
    pList[pDesc->List.ListButtonCnt].ButtonIndex  = pDesc->List.ListButtonCnt;
    pList[pDesc->List.ListButtonCnt].TxtId        = PHONE_TEXT_ID_ADD_REMINDER;
    pList[pDesc->List.ListButtonCnt++].ReleaseFun = Cale_Rel_Func_Add_Reminder;

    // view today
    if (FALSE == UI_Cale_Is_On_Show_Reminder_Empty())
    {
        pList[pDesc->List.ListButtonCnt].Valid        = TRUE;
        pList[pDesc->List.ListButtonCnt].ButtonIndex  = pDesc->List.ListButtonCnt;
        pList[pDesc->List.ListButtonCnt].TxtId        = PHONE_TEXT_ID_VIEW_TODAY;
        pList[pDesc->List.ListButtonCnt++].ReleaseFun = Cale_Rel_Func_View_Today;
    }

    // Reminder List
    if (_lv_ll_get_head(&g_CalendarMng.Reminder))
    {
        pList[pDesc->List.ListButtonCnt].Valid        = TRUE;
        pList[pDesc->List.ListButtonCnt].ButtonIndex  = pDesc->List.ListButtonCnt;
        pList[pDesc->List.ListButtonCnt].TxtId        = PHONE_TEXT_ID_VIEW_ALL;
        pList[pDesc->List.ListButtonCnt++].ReleaseFun = Cale_Rel_Func_View_All;
    }

    // Go to Date
    pList[pDesc->List.ListButtonCnt].Valid        = TRUE;
    pList[pDesc->List.ListButtonCnt].ButtonIndex  = pDesc->List.ListButtonCnt;
    pList[pDesc->List.ListButtonCnt].TxtId        = PHONE_TEXT_ID_GOTO_DATE;
    pList[pDesc->List.ListButtonCnt++].ReleaseFun = Cale_Rel_Func_Go_To_Date;

    // Lunar calendar
    pList[pDesc->List.ListButtonCnt].Valid        = TRUE;
    pList[pDesc->List.ListButtonCnt].ButtonIndex  = pDesc->List.ListButtonCnt;
    pList[pDesc->List.ListButtonCnt].TxtId        = PHONE_TEXT_ID_LUNAR;
    pList[pDesc->List.ListButtonCnt++].ReleaseFun = Cale_Rel_Func_Lunar_Cale;

    /* set button bar */
    pDesc->BtnBar.ButtonR.Valid = TRUE;
    pDesc->BtnBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;
    pDesc->BtnBar.ButtonM.Valid = TRUE;
    pDesc->BtnBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;

    pDesc->KeyFunc = Cale_Key_Proc_Cale_Opt;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_OPTION, &FuncList, pDesc);
} /* Display_Calendar_Option */


/**
 * Process On Save event of Goto Date
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Save_Go_To_Date(VOID *pDesc)
{
    UI_Normal_Date_Desc_t *pTmpDesc = (UI_Normal_Date_Desc_t *)pDesc;
    INT8 Buf[5] = {0};

    lv_roller_get_selected_str(pTmpDesc->ContDate.RollerDay.Roller, Buf,0);
    pTmpDesc->ContDate.RollerDay.MidValue = atoi(Buf);
    lv_roller_get_selected_str(pTmpDesc->ContDate.RollerMonth.Roller, Buf,0);
    pTmpDesc->ContDate.RollerMonth.MidValue = atoi(Buf);
    lv_roller_get_selected_str(pTmpDesc->ContDate.RollerYear.Roller, Buf,0);
    pTmpDesc->ContDate.RollerYear.MidValue = atoi(Buf);

    Cale_Common_Save(pDesc);
}


/**
 * display Calendar Go to date UI
 * common ui: UI_Normal_Date_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Go_To_Date(VOID)
{
    Nav_Func_List_t       FuncList = { 0 };
    UI_Normal_Date_Desc_t *pDesc;

    FuncList.OnShow         = UI_Normal_Date_Create;
    FuncList.OnCreate       = Cale_Common_Restore;
    FuncList.OnDestroy      = Cale_Common_Destory;
    FuncList.OnSaveState    = Cale_On_Save_Go_To_Date;
    FuncList.OnRestoreState = Cale_Common_Restore;

    pDesc = (UI_Normal_Date_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_Date_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_Date_Desc_t));

    // Set the UI description parameters
    pDesc->TitleBar.TxtId      = PHONE_TEXT_ID_DATE;
    pDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    pDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    pDesc->ContDate.RollerDay.RollerType = UI_ROLLER_TYPE_DAY;
    pDesc->ContDate.RollerDay.MidValue   = g_CalendarMng.DayOnShow.day;

    pDesc->ContDate.RollerMonth.RollerType = UI_ROLLER_TYPE_MONTH;
    pDesc->ContDate.RollerMonth.MidValue   = g_CalendarMng.DayOnShow.month;

    pDesc->ContDate.RollerYear.RollerType = UI_ROLLER_TYPE_YEAR;
    pDesc->ContDate.RollerYear.MidValue   = g_CalendarMng.DayOnShow.year;

    pDesc->ButtonBar.ButtonL.Valid       = FALSE;
    pDesc->ButtonBar.ButtonM.Valid       = TRUE;
    pDesc->ButtonBar.ButtonM.ButtonIndex = 1;
    pDesc->ButtonBar.ButtonM.TxtId       = PHONE_TEXT_ID_OK;
    pDesc->ButtonBar.ButtonR.Valid       = TRUE;
    pDesc->ButtonBar.ButtonR.ButtonIndex = 2;
    pDesc->ButtonBar.ButtonR.TxtId       = PHONE_TEXT_ID_BACK;
    pDesc->KeyFunc                       = Cale_Key_Proc_Go_To_Date;

    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_GO_TO_DATE, &FuncList, pDesc);
} /* Display_Calendar_Go_To_Date */

/**
 * display Calendar for chinese UI
 * common ui:  UI_Status_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_For_Chinese(VOID)
{
    Display_Cale_Status(ACT_ID_CALENDAR_FOR_CHINESE);
}

/**
 * Process On Created event of Add Reminder
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_Add_Reminder(VOID *pDesc)
{
    UI_Normal_NoTitle_Label_Ta_Desc_t *pTmpDesc;
    INT8                              TmpChar[3] = {};

    g_CalendarMng.CurrentDesc     = pDesc;
    g_CalendarMng.ReminderTxtLeft = UI_CALENDAR_MAX_REMINDER_INPUT_LEFT;
    g_CalendarMng.ReminderInOper  = NULL;
    pTmpDesc                      = (UI_Normal_NoTitle_Label_Ta_Desc_t *)pDesc;

    Ime_Set_GetCharLen_Func(UI_Cale_Input_Handler);   // register char input call back
    sprintf(TmpChar, "%d", g_CalendarMng.ReminderTxtLeft);
    lv_label_set_text(pTmpDesc->ContLabelTr.Label, TmpChar);
    lv_textarea_set_max_length(pTmpDesc->ContTa.TextArea, UI_CALENDAR_MAX_REMINDER_INPUT_LEFT);
}

/**
 * Process On Save event of Add Reminder
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Save_Add_Reminder(VOID *pDesc)
{
    UI_Normal_NoTitle_Label_Ta_Desc_t *pTmpDesc;
    const INT8                        *TaTxt;
    UINT8                             TaTxtLen;

    pTmpDesc = (UI_Normal_NoTitle_Label_Ta_Desc_t *)pDesc;
    TaTxt    = lv_textarea_get_text(pTmpDesc->ContTa.TextArea);
    TaTxtLen = strlen(TaTxt) + 1;

    if (1 < TaTxtLen)
    {
        pTmpDesc->ContTa.TaTxt = (INT8 *)Hal_Mem_Alloc(TaTxtLen);
        Hal_Mem_Copy(pTmpDesc->ContTa.TaTxt, (INT8 *)TaTxt, TaTxtLen);
        pTmpDesc->ButtonCont.ButtonR.TxtId = PHONE_TEXT_ID_CLEAR;
    }
    else
    {
        pTmpDesc->ButtonCont.ButtonR.TxtId = PHONE_TEXT_ID_BACK;
    }

    Cale_Common_Save(pDesc);
}

/**
 * Process On Restore event of Add Reminder
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Restore_Add_Reminder(VOID *pDesc)
{
    UI_Normal_NoTitle_Label_Ta_Desc_t *pTmpDesc;
    INT8                              TmpChar[3] = {};

    Cale_Common_Restore(pDesc);
    pTmpDesc = (UI_Normal_NoTitle_Label_Ta_Desc_t *)pDesc;

    Ime_Set_GetCharLen_Func(UI_Cale_Input_Handler);   // register char input call back
    sprintf(TmpChar, "%d", g_CalendarMng.ReminderTxtLeft);
    lv_label_set_text(pTmpDesc->ContLabelTr.Label, TmpChar);
    lv_textarea_set_max_length(pTmpDesc->ContTa.TextArea, UI_CALENDAR_MAX_REMINDER_INPUT_LEFT);
    if (0 < strlen(pTmpDesc->ContTa.TaTxt))
    {
        Hal_Mem_Free(pTmpDesc->ContTa.TaTxt);
        pTmpDesc->ContTa.TaTxt = "";
    }
    if (g_CalendarMng.ReminderInOper)
    {
        Hal_Mem_Free(g_CalendarMng.ReminderInOper);
        g_CalendarMng.ReminderInOper = NULL;
    }
}

/**
 * Process On Destroy event of Add Reminder
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_Add_Reminder(VOID *pDesc)
{
    UI_Normal_NoTitle_Label_Ta_Desc_t *pTmpDesc = (UI_Normal_NoTitle_Label_Ta_Desc_t *)pDesc;

    if (0 < strlen(pTmpDesc->ContTa.TaTxt))
    {
        Hal_Mem_Free(pTmpDesc->ContTa.TaTxt);
    }
    Cale_Common_Destory(pDesc);
    if (g_CalendarMng.ReminderInOper)
    {
        Hal_Mem_Free(g_CalendarMng.ReminderInOper);
        g_CalendarMng.ReminderInOper = NULL;
    }
    g_CalendarMng.Process = UI_CALE_PROCESS_NULL;
}

/**
 * display Calendar reminder UI
 * common ui: UI_Normal_NoTitle_Label_Ta_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Add_Reminder(VOID)
{
    Nav_Func_List_t                   FuncList = { 0 };
    UI_Normal_NoTitle_Label_Ta_Desc_t *pDesc;

    FuncList.OnShow         = UI_Normal_NoTitle_Label_Ta_Create;
    FuncList.OnCreate       = Cale_On_Create_Add_Reminder;
    FuncList.OnDestroy      = Cale_On_Destroy_Add_Reminder;
    FuncList.OnSaveState    = Cale_On_Save_Add_Reminder;
    FuncList.OnRestoreState = Cale_On_Restore_Add_Reminder;

    pDesc = (UI_Normal_NoTitle_Label_Ta_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_NoTitle_Label_Ta_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_NoTitle_Label_Ta_Desc_t));

    pDesc->ContLabelTl.TxtAlign = LV_LABEL_ALIGN_LEFT;
    pDesc->ContLabelTr.TxtAlign = LV_LABEL_ALIGN_RIGHT;
    pDesc->ContLabelTr.TxtId    = LV_LANG_TXT_ID_NONE;

    pDesc->ContLabel.TxtId    = PHONE_TEXT_ID_REMINDER_ABOUT;
    pDesc->ContLabel.TxtAlign = LV_LABEL_ALIGN_LEFT;

    pDesc->ContTa.TaCursorHide = FALSE;
    pDesc->ContTa.TaAlign      = LV_LABEL_ALIGN_LEFT;
    pDesc->ContTa.TaTxt        = "";

    pDesc->ButtonCont.ButtonL.Valid = FALSE;
    pDesc->ButtonCont.ButtonM.Valid = TRUE;
    pDesc->ButtonCont.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    pDesc->ButtonCont.ButtonR.Valid = TRUE;
    pDesc->ButtonCont.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    pDesc->KeyFunc = Cale_Key_Proc_Add_Reminder;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_ADD_REMINDER, &FuncList, pDesc);
}

/**
 * Process On Created event of Set Alarm
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_Set_Alarm(VOID *pDesc)
{
    g_CalendarMng.CurrentDesc = pDesc;
}

/**
 * Process On destroy event of Set Alarm
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_Set_Alarm(VOID *pDesc)
{
    UI_Normal_List_Only_Desc_t *pTmpDesc;

    pTmpDesc = (UI_Normal_List_Only_Desc_t *)pDesc;
    Hal_Mem_Free(pTmpDesc->List.ButtonList);
    Cale_Common_Destory(pDesc);
}

/**
 * display Calendar set alarm UI
 * common ui: UI_Normal_List_Only_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Set_Alarm(VOID)
{
    Nav_Func_List_t            FuncList = { 0 };
    UI_Normal_List_Only_Desc_t *pDesc;
    UI_Button_Desc_t           *pList;

    FuncList.OnShow         = UI_Normal_List_Only_Create;
    FuncList.OnCreate       = Cale_On_Create_Set_Alarm;
    FuncList.OnDestroy      = Cale_On_Destroy_Set_Alarm;
    FuncList.OnSaveState    = Cale_Common_Save;
    FuncList.OnRestoreState = Cale_Common_Restore;

    pDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    pDesc->TitleBar.TxtId    = PHONE_TEXT_ID_REMINDER_SET_ALARM;
    pDesc->TitleBar.TxtAlign = LV_LABEL_ALIGN_CENTER;

    pList = (UI_Button_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Button_Desc_t) * 2);
    Hal_Mem_Set(pList, 0, sizeof(UI_Button_Desc_t) * 2);
    pDesc->List.ButtonList = pList;

    // Alarm On
    pList[pDesc->List.ListButtonCnt].Valid        = TRUE;
    pList[pDesc->List.ListButtonCnt].ButtonIndex  = pDesc->List.ListButtonCnt;
    pList[pDesc->List.ListButtonCnt].TxtId        = PHONE_TEXT_ID_REMINDER_ALARM_ON;
    pList[pDesc->List.ListButtonCnt++].ReleaseFun = Cale_Rel_Func_Alarm_On;

    // Alarm Off
    pList[pDesc->List.ListButtonCnt].Valid        = TRUE;
    pList[pDesc->List.ListButtonCnt].ButtonIndex  = pDesc->List.ListButtonCnt;
    pList[pDesc->List.ListButtonCnt].TxtId        = PHONE_TEXT_ID_REMINDER_ALARM_OFF;
    pList[pDesc->List.ListButtonCnt++].ReleaseFun = Cale_Rel_Func_Alarm_Off;

    /* set button bar */
    pDesc->BtnBar.ButtonR.Valid = TRUE;
    pDesc->BtnBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;
    pDesc->BtnBar.ButtonM.Valid = TRUE;
    pDesc->BtnBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;

    pDesc->KeyFunc = Cale_Key_Proc_Set_Alarm;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_SET_ALARM, &FuncList, pDesc);
} /* Display_Calendar_Set_Alarm */

/**
 * Process On Save event of Set Time
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Save_Set_Time(VOID *pDesc)
{
    UI_Normal_Time_Desc_t *pTmpDesc = (UI_Normal_Time_Desc_t *)pDesc;;
    INT8 Buf[3] = {0};

    lv_roller_get_selected_str(pTmpDesc->ContTime.Roller1.Roller, Buf,0);
    pTmpDesc->ContTime.Roller1.MidValue = atoi(Buf);
    lv_roller_get_selected_str(pTmpDesc->ContTime.Roller2.Roller, Buf,0);
    pTmpDesc->ContTime.Roller2.MidValue = atoi(Buf);

    Cale_Common_Save(pDesc);
}

/**
 * display Calendar set time UI
 * common ui: UI_Normal_Time_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Set_Time(VOID)
{
    Nav_Func_List_t       FuncList = { 0 };
    UI_Normal_Time_Desc_t *pDesc;
    hal_rtc_t             Time;

    FuncList.OnShow         = UI_Normal_Time_Create;
    FuncList.OnCreate       = Cale_Common_Restore;
    FuncList.OnDestroy      = Cale_Common_Destory;
    FuncList.OnSaveState    = Cale_On_Save_Set_Time;
    FuncList.OnRestoreState = Cale_Common_Restore;

    pDesc = (UI_Normal_Time_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_Time_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_Time_Desc_t));

    pDesc->TitleBar.TxtId    = PHONE_TEXT_ID_TIME;
    pDesc->TitleBar.TxtAlign = LV_LABEL_ALIGN_CENTER;

    // Get the current time
    Hal_Rtc_Gettime(&Time);
    pDesc->ContTime.Roller1.MidValue   = Time.tm_hour;
    pDesc->ContTime.Roller1.RollerType = UI_ROLLER_TYPE_HOUR;

    pDesc->ContTime.Roller2.MidValue   = Time.tm_min;
    pDesc->ContTime.Roller2.RollerType = UI_ROLLER_TYPE_MINUTE;

    pDesc->ButtonBar.ButtonL.Valid = FALSE;
    pDesc->ButtonBar.ButtonM.Valid = TRUE;
    pDesc->ButtonBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    pDesc->ButtonBar.ButtonR.Valid = TRUE;
    pDesc->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    pDesc->KeyFunc = Cale_Key_Proc_Set_Time;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_SET_TIME, &FuncList, pDesc);
} /* Display_Calendar_Set_Time */

/**
 * Process On Save event of Set Date
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Save_Set_Date(VOID *pDesc)
{
    UI_Normal_Date_Desc_t *pTmpDesc = (UI_Normal_Date_Desc_t *)pDesc;;
    INT8 Buf[5] = {0};

    lv_roller_get_selected_str(pTmpDesc->ContDate.RollerYear.Roller, Buf,0);
    pTmpDesc->ContDate.RollerYear.MidValue = atoi(Buf);
    lv_roller_get_selected_str(pTmpDesc->ContDate.RollerMonth.Roller, Buf,0);
    pTmpDesc->ContDate.RollerMonth.MidValue = atoi(Buf);
    lv_roller_get_selected_str(pTmpDesc->ContDate.RollerDay.Roller, Buf,0);
    pTmpDesc->ContDate.RollerDay.MidValue = atoi(Buf);

    Cale_Common_Save(pDesc);
}

/**
 * display Calendar set date UI
 * common ui: UI_Normal_Date_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Set_Date(VOID)
{
    Nav_Func_List_t       FuncList = { 0 };
    UI_Normal_Date_Desc_t *pDesc;
    hal_rtc_t             Time;

    FuncList.OnShow         = UI_Normal_Date_Create;
    FuncList.OnCreate       = Cale_Common_Restore;
    FuncList.OnDestroy      = Cale_Common_Destory;
    FuncList.OnSaveState    = Cale_On_Save_Set_Date;
    FuncList.OnRestoreState = Cale_Common_Restore;

    pDesc = (UI_Normal_Date_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_Date_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_Date_Desc_t));

    pDesc->TitleBar.TxtId    = PHONE_TEXT_ID_DATE;
    pDesc->TitleBar.TxtAlign = LV_LABEL_ALIGN_CENTER;

    // Get the current time
    Hal_Rtc_Gettime(&Time);
    pDesc->ContDate.RollerYear.MidValue   = Time.tm_year;
    pDesc->ContDate.RollerYear.RollerType = UI_ROLLER_TYPE_YEAR;

    pDesc->ContDate.RollerMonth.MidValue   = Time.tm_mon;
    pDesc->ContDate.RollerMonth.RollerType = UI_ROLLER_TYPE_MONTH;

    pDesc->ContDate.RollerDay.MidValue   = Time.tm_mday;
    pDesc->ContDate.RollerDay.RollerType = UI_ROLLER_TYPE_DAY;

    pDesc->ButtonBar.ButtonL.Valid = FALSE;
    pDesc->ButtonBar.ButtonM.Valid = TRUE;
    pDesc->ButtonBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    pDesc->ButtonBar.ButtonR.Valid = TRUE;
    pDesc->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    pDesc->KeyFunc = Cale_Key_Proc_Set_Date;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_SET_DATE, &FuncList, pDesc);
}

/**
 * display Calendar date past UI
 * common ui: UI_Status_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Date_Past(VOID)
{
    Display_Cale_Status(ACT_ID_CALENDAR_DATE_PAST);
}

/**
 * display Calendar reminder added UI
 * common ui: UI_Status_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Reminder_Added(VOID)
{
    Display_Cale_Status(ACT_ID_CALENDAR_REMINDER_ADDED);
}

#if 0
/**
 * Process On Created event of View Today
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_View_Today(VOID *pDesc)
{
    g_CalendarMng.CurrentDesc = pDesc;
    g_CalendarMng.ReminderInOper = UI_Cale_Get_Next_Reminder(NULL, TRUE);
    UI_Cale_Display_Reminder((UI_Normal_Reminder_Desc_t *)pDesc, g_CalendarMng.ReminderInOper, TRUE);
}

/**
 * Process On restored event of View Today
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Restore_View_Today(VOID *pDesc)
{
    g_CalendarMng.CurrentDesc = pDesc;
    UI_Cale_Display_Reminder((UI_Normal_Reminder_Desc_t *)pDesc, g_CalendarMng.ReminderInOper, TRUE);
}

/**
 * Process On destroyed event of View Today
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_View_Today(VOID *pDesc)
{
    g_CalendarMng.Process        = UI_CALE_PROCESS_NULL;
    g_CalendarMng.ReminderInOper = NULL;
    Cale_Common_Destory(pDesc);
}

/**
 * display Calendar view today UI
 * common ui: UI_Normal_Reminder_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_View_Today(VOID)
{
    Nav_Func_List_t           FuncList = { 0 };
    UI_Normal_Reminder_Desc_t *pDesc;

    FuncList.OnShow         = UI_Normal_Reminder_Create;
    FuncList.OnCreate       = Cale_On_Create_View_Today;
    FuncList.OnDestroy      = Cale_On_Destroy_View_Today;
    FuncList.OnSaveState    = Cale_Common_Save;
    FuncList.OnRestoreState = Cale_On_Restore_View_Today;

    pDesc = (UI_Normal_Reminder_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_Reminder_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_Reminder_Desc_t));

    pDesc->TitleLabelL.TxtId    = LV_LANG_TXT_ID_NONE;
    pDesc->TitleLabelL.TxtAlign = LV_LABEL_ALIGN_LEFT;
    pDesc->TitleLabelR.TxtId    = LV_LANG_TXT_ID_NONE;
    pDesc->TitleLabelR.TxtAlign = LV_LABEL_ALIGN_RIGHT;

    pDesc->ContLabel.TxtId = LV_LANG_TXT_ID_NONE;

    pDesc->ButtonCont.ButtonL.Valid = TRUE;
    pDesc->ButtonCont.ButtonL.TxtId = PHONE_TEXT_ID_OPT;
    pDesc->ButtonCont.ButtonM.Valid = FALSE;
    pDesc->ButtonCont.ButtonR.Valid = TRUE;
    pDesc->ButtonCont.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    pDesc->KeyFunc = Cale_Key_Proc_View_Today;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_VIEW_TODAY, &FuncList, pDesc);
}
#endif

/**
 * Process On Created event of Lunar cale
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_Lunar_Cale(VOID *pDesc)
{
    g_CalendarMng.CurrentDesc = pDesc;
    UI_Cale_Show_Lunar_Info(pDesc);
}

/**
 * Process On destroy event of Lunar cale
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_Lunar_Cale(VOID *pDesc)
{
    Hal_Mem_Free(g_CalendarMng.LunarDate);
    g_CalendarMng.LunarDate = NULL;
    Cale_Common_Destory(pDesc);
}

/**
 * display Calendar view today UI
 * common ui: UI_Container_Label_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Lunar_Cale(VOID)
{
    Nav_Func_List_t          FuncList = { 0 };
    UI_Normal_NoTitle_Desc_t *pDesc;

    FuncList.OnShow         = UI_Normal_NoTitle_Create;
    FuncList.OnCreate       = Cale_On_Create_Lunar_Cale;
    FuncList.OnDestroy      = Cale_On_Destroy_Lunar_Cale;
    FuncList.OnSaveState    = Cale_Common_Save;
    FuncList.OnRestoreState = Cale_On_Create_Lunar_Cale;

    pDesc = (UI_Normal_NoTitle_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_NoTitle_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_NoTitle_Desc_t));

    pDesc->ContenCont.ContLabel.TxtId    = LV_LANG_TXT_ID_NONE;
    pDesc->ContenCont.ContLabel.TxtAlign = LV_LABEL_ALIGN_CENTER;

    pDesc->ButtonBar.ButtonL.Valid = FALSE;
    pDesc->ButtonBar.ButtonM.Valid = TRUE;
    pDesc->ButtonBar.ButtonM.TxtId = PHONE_TEXT_ID_SEARCH;
    pDesc->ButtonBar.ButtonR.Valid = TRUE;
    pDesc->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    pDesc->KeyFunc = Cale_Key_Proc_Lunar_Cale;

    // get fisrt Lunar date for display
    g_CalendarMng.LunarDate = (lv_calendar_date_t *)Hal_Mem_Alloc(sizeof(lv_calendar_date_t));
    Hal_Mem_Copy(g_CalendarMng.LunarDate, &(g_CalendarMng.DayOnShow), sizeof(lv_calendar_date_t));

    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_LUNAR_CALE, &FuncList, pDesc);
}

/**
 * Process On Created event of Date Past
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_View_Option(VOID *pDesc)
{
    g_CalendarMng.CurrentDesc = pDesc;
}

/**
 * Process On Destroy event of Date Past
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_View_Option(VOID *pDesc)
{
    UI_Normal_List_Only_Desc_t *pTmpDesc;

    pTmpDesc = (UI_Normal_List_Only_Desc_t *)pDesc;
    Hal_Mem_Free(pTmpDesc->List.ButtonList);
    Cale_Common_Destory(pDesc);
}

/**
 * display Calendar view option UI
 * common ui: UI_Normal_List_Only_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_View_Option(VOID)
{
    Nav_Func_List_t            FuncList = { 0 };
    UI_Normal_List_Only_Desc_t *pDesc;
    UI_Button_Desc_t           *pList;

    FuncList.OnShow         = UI_Normal_List_Only_Create;
    FuncList.OnCreate       = Cale_On_Create_View_Option;
    FuncList.OnDestroy      = Cale_On_Destroy_View_Option;
    FuncList.OnSaveState    = Cale_Common_Save;
    FuncList.OnRestoreState = Cale_Common_Restore;

    pDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    pDesc->TitleBar.TxtId    = PHONE_TEXT_ID_REMINDER_ADDED;// PHONE_TEXT_ID_REMINDER;
    pDesc->TitleBar.TxtAlign = LV_LABEL_ALIGN_CENTER;

    pList = (UI_Button_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Button_Desc_t) * 2);
    Hal_Mem_Set(pList, 0, sizeof(UI_Button_Desc_t) * 2);
    pDesc->List.ButtonList = pList;

    // Delete
    pList[pDesc->List.ListButtonCnt].Valid        = TRUE;
    pList[pDesc->List.ListButtonCnt].ButtonIndex  = pDesc->List.ListButtonCnt;
    pList[pDesc->List.ListButtonCnt].TxtId        = PHONE_TEXT_ID_DELETE;
    pList[pDesc->List.ListButtonCnt++].ReleaseFun = Cale_Rel_Func_View_Option_Delete;

    // Edit
    pList[pDesc->List.ListButtonCnt].Valid        = TRUE;
    pList[pDesc->List.ListButtonCnt].ButtonIndex  = pDesc->List.ListButtonCnt;
    pList[pDesc->List.ListButtonCnt].TxtId        = PHONE_TEXT_ID_EDIT;
    pList[pDesc->List.ListButtonCnt++].ReleaseFun = Cale_Rel_Func_View_Option_Edit;

    /* set button bar */
    pDesc->BtnBar.ButtonR.Valid = TRUE;
    pDesc->BtnBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;
    pDesc->BtnBar.ButtonM.Valid = TRUE;
    pDesc->BtnBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;

    pDesc->KeyFunc = Cale_Key_Proc_Cale_View_Opt;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_VIEW_OPTION, &FuncList, pDesc);
} /* Display_Calendar_View_Option */

/**
 * Process On Created event of View Edit
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_View_Edit(VOID *pDesc)
{
    UI_Normal_NoTitle_Label_Ta_Desc_t *pTmpDesc;
    INT8                              TmpChar[3] = {};

    g_CalendarMng.CurrentDesc = pDesc;
    pTmpDesc                  = (UI_Normal_NoTitle_Label_Ta_Desc_t *)pDesc;

    Ime_Set_GetCharLen_Func(UI_Cale_Input_Handler);   // register char input call back
    sprintf(TmpChar, "%d", g_CalendarMng.ReminderTxtLeft);
    lv_label_set_text(pTmpDesc->ContLabelTr.Label, TmpChar);
    Hal_Mem_Free(pTmpDesc->ContTa.TaTxt);
    pTmpDesc->ContTa.TaTxt = NULL;
}

/**
 * Process On restored event of View Edit
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Restore_View_Edit(VOID *pDesc)
{
    UI_Normal_NoTitle_Label_Ta_Desc_t *pTmpDesc;
    INT8                              TmpChar[3] = {};

    g_CalendarMng.CurrentDesc = pDesc;
    pTmpDesc                  = (UI_Normal_NoTitle_Label_Ta_Desc_t *)pDesc;

    Ime_Set_GetCharLen_Func(UI_Cale_Input_Handler);   // register char input call back
    sprintf(TmpChar, "%d", g_CalendarMng.ReminderTxtLeft);
    lv_label_set_text(pTmpDesc->ContLabelTr.Label, TmpChar);
    Hal_Mem_Free(pTmpDesc->ContTa.TaTxt);
    pTmpDesc->ContTa.TaTxt = NULL;
    if (g_CalendarMng.EditTxt)
    {
        Hal_Mem_Free(g_CalendarMng.EditTxt);
        g_CalendarMng.EditTxt = NULL;
    }
}

/**
 * Process On destroyed event of View Edit
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_View_Edit(VOID *pDesc)
{
    UI_Normal_NoTitle_Label_Ta_Desc_t *pTmpDesc;

    pTmpDesc = (UI_Normal_NoTitle_Label_Ta_Desc_t *)pDesc;
    if (pTmpDesc->ContTa.TaTxt)
    {
        Hal_Mem_Free(pTmpDesc->ContTa.TaTxt);
    }
    Cale_Common_Destory(pDesc);
    if (g_CalendarMng.EditTxt)
    {
        Hal_Mem_Free(g_CalendarMng.EditTxt);
        g_CalendarMng.EditTxt = NULL;
    }
}

/**
 * Process On saved event of View Edit
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Save_View_Edit(VOID *pDesc)
{
    UI_Normal_NoTitle_Label_Ta_Desc_t *pTmpDesc;
    const INT8 *Text;
    UINT8 Len;

    pTmpDesc = (UI_Normal_NoTitle_Label_Ta_Desc_t *)pDesc;
    Text = lv_textarea_get_text(pTmpDesc->ContTa.TextArea);
    Len = strlen(Text);
    pTmpDesc->ContTa.TaTxt = (INT8 *)Hal_Mem_Alloc(Len + 1);
    Hal_Mem_Copy(pTmpDesc->ContTa.TaTxt, Text, Len + 1);
    Cale_Common_Save(pDesc);
}

/**
 * display Calendar view edit UI
 * common ui: UI_Normal_NoTitle_Label_Ta_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_View_Edit(VOID)
{
    Nav_Func_List_t                   FuncList = { 0 };
    UI_Normal_NoTitle_Label_Ta_Desc_t *pDesc;
    UINT8                             Len;

    FuncList.OnShow         = UI_Normal_NoTitle_Label_Ta_Create;
    FuncList.OnCreate       = Cale_On_Create_View_Edit;
    FuncList.OnDestroy      = Cale_On_Destroy_View_Edit;
    FuncList.OnSaveState    = Cale_On_Save_View_Edit;
    FuncList.OnRestoreState = Cale_On_Restore_View_Edit;

    pDesc = (UI_Normal_NoTitle_Label_Ta_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_NoTitle_Label_Ta_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_NoTitle_Label_Ta_Desc_t));

    pDesc->ContLabelTl.TxtAlign = LV_LABEL_ALIGN_LEFT;
    pDesc->ContLabelTr.TxtAlign = LV_LABEL_ALIGN_RIGHT;
    pDesc->ContLabelTr.TxtId    = LV_LANG_TXT_ID_NONE;

    pDesc->ContLabel.TxtId    = PHONE_TEXT_ID_REMINDER_ABOUT;
    pDesc->ContLabel.TxtAlign = LV_LABEL_ALIGN_LEFT;

    pDesc->ContTa.TaCursorHide    = FALSE;
    pDesc->ContTa.TaAlign         = LV_LABEL_ALIGN_LEFT;
    Len = strlen(g_CalendarMng.ReminderInOper->Info.Text);
    pDesc->ContTa.TaTxt           = (INT8 *)Hal_Mem_Alloc(Len + 1);
    Hal_Mem_Copy(pDesc->ContTa.TaTxt, g_CalendarMng.ReminderInOper->Info.Text, Len + 1);
    g_CalendarMng.ReminderTxtLeft = UI_CALENDAR_MAX_REMINDER_INPUT_LEFT - strlen(pDesc->ContTa.TaTxt);

    pDesc->ButtonCont.ButtonL.Valid = FALSE;
    pDesc->ButtonCont.ButtonM.Valid = TRUE;
    pDesc->ButtonCont.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    pDesc->ButtonCont.ButtonR.Valid = TRUE;

    if (UI_CALENDAR_MAX_REMINDER_INPUT_LEFT == g_CalendarMng.ReminderTxtLeft)
    {
        pDesc->ButtonCont.ButtonR.TxtId = PHONE_TEXT_ID_BACK;
    }
    else
    {
        pDesc->ButtonCont.ButtonR.TxtId = PHONE_TEXT_ID_CLEAR;
    }

    pDesc->KeyFunc = Cale_Key_Proc_View_Edit;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_VIEW_EDIT, &FuncList, pDesc);
} /* Display_Calendar_View_Edit */

/**
 * Process On Created event of Calendar Delete
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_Calendar_Delete(VOID *pDesc)
{
    UI_Normal_NoTitle_Desc_t *pTmpDesc;
    INT8                     TmpChar[100] = {};

    g_CalendarMng.CurrentDesc = pDesc;
    pTmpDesc                  = (UI_Normal_NoTitle_Desc_t *)pDesc;

    // set reminder number
    sprintf(TmpChar, "%s\n\n%s",
            (INT8 *)lv_lang_get_text(PHONE_TEXT_ID_DELETE_Q),
            g_CalendarMng.ReminderInOper->Info.Text);
    lv_label_set_text(pTmpDesc->ContenCont.ContLabel.Label, TmpChar);
}

/**
 * display Calendar delete UI
 * common ui: UI_Normal_NoTitle_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Delete(VOID)
{
    Nav_Func_List_t          FuncList = { 0 };
    UI_Normal_NoTitle_Desc_t *pDesc;

    FuncList.OnShow         = UI_Normal_NoTitle_Create;
    FuncList.OnCreate       = Cale_On_Create_Calendar_Delete;
    FuncList.OnDestroy      = Cale_Common_Destory;
    FuncList.OnSaveState    = Cale_Common_Save;
    FuncList.OnRestoreState = Cale_On_Create_Calendar_Delete;

    pDesc = (UI_Normal_NoTitle_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_NoTitle_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_NoTitle_Desc_t));

    pDesc->ContenCont.ContLabel.TxtId    = LV_LANG_TXT_ID_NONE;
    pDesc->ContenCont.ContLabel.TxtAlign = LV_LABEL_ALIGN_LEFT;

    pDesc->ButtonBar.ButtonL.Valid = FALSE;
    pDesc->ButtonBar.ButtonM.Valid = TRUE;
    pDesc->ButtonBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    pDesc->ButtonBar.ButtonR.Valid = TRUE;
    pDesc->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    pDesc->KeyFunc = Cale_Key_Proc_Cale_Delete;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_DELETE, &FuncList, pDesc);
}

/**
 * display Calendar deleted reminder UI
 * common ui: UI_Status_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Reminder_Deleted(VOID)
{
    Display_Cale_Status(ACT_ID_CALENDAR_REMINDER_DELETED);
}

/**
 * display Calendar reminder memory empty UI
 * common ui: UI_Status_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Reminder_Memory_Empty(VOID)
{
    Display_Cale_Status(ACT_ID_CALENDAR_REMINDER_MEMORY_EMPTY);
}

/**
 * Process On Created event of Reminder Alarm Ring
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_Reminder_Alarm_Ring(VOID *pDesc)
{
    UI_Normal_Reminder_Alarm_Desc_t *pTmpDesc;
    INT8                            TmpChar[20] = {};

    g_CalendarMng.CurrentDesc = pDesc;
    pTmpDesc                  = (UI_Normal_Reminder_Alarm_Desc_t *)pDesc;

    if (UI_LANG_EN == lv_lang_act())
    {
        sprintf(TmpChar, "%.2d:%.2d\n%.2d.%.2d.%.4d",
                g_CalendarMng.RingReminder->Info.Hour,
                g_CalendarMng.RingReminder->Info.Min,
                g_CalendarMng.RingReminder->Info.Day,
                g_CalendarMng.RingReminder->Info.Mon,
                g_CalendarMng.RingReminder->Info.Year);
    }
    else
    {
        sprintf(TmpChar, "%.2d:%.2d\n%.4d.%.2d.%.2d",
                g_CalendarMng.RingReminder->Info.Hour,
                g_CalendarMng.RingReminder->Info.Min,
                g_CalendarMng.RingReminder->Info.Year,
                g_CalendarMng.RingReminder->Info.Mon,
                g_CalendarMng.RingReminder->Info.Day);
    }
    lv_label_set_text(pTmpDesc->ContLabelR.Label, TmpChar);

    // set reminder txt
    lv_label_set_text(pTmpDesc->ContLabelD.Label, g_CalendarMng.RingReminder->Info.Text);
}

/**
 * Process on saved event of Reminder Alarm Ring
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Save_Reminder_Alarm_Ring(VOID *pDesc)
{
    If_Setting_Play_Tone_t *PlayToneReq;

    if (g_CalendarMng.RingTimer)
    {
        Hal_Timer_Stop(g_CalendarMng.RingTimer);
        g_CalendarMng.RingTimer = NULL;

        printf("%s: stop timer and tone\n", __FUNCTION__);

        PlayToneReq = (If_Setting_Play_Tone_t *)Hal_Mem_Alloc(sizeof(If_Setting_Play_Tone_t));
        PlayToneReq->PlayCtrl = IF_SETTING_PLAY_TONS_STOP;
        PlayToneReq->ToneType = IF_SETTING_TONS_TYPE_CALENDAR;
        Setting_Play_Tone_Req(PlayToneReq);
    }

    Cale_Common_Save(pDesc);
}

/**
 * Process On Destroyed event of Reminder Alarm Ring
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_Reminder_Alarm_Ring(VOID *pDesc)
{
    if (g_CalendarMng.RingTimer)
    {
        Hal_Timer_Stop(g_CalendarMng.RingTimer);
        g_CalendarMng.RingTimer = NULL;
    }
    Cale_Common_Destory(pDesc);
}

/**
 * display Calendar reminder alarm ring UI
 * common ui: UI_Normal_Reminder_Alarm_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Reminder_Alarm_Ring(VOID)
{
    Nav_Func_List_t                 FuncList = { 0 };
    UI_Normal_Reminder_Alarm_Desc_t *pDesc;

    FuncList.OnShow         = UI_Normal_Reminder_Alarm_Create;
    FuncList.OnCreate       = Cale_On_Create_Reminder_Alarm_Ring;
    FuncList.OnDestroy      = Cale_On_Destroy_Reminder_Alarm_Ring;
    FuncList.OnSaveState    = Cale_On_Save_Reminder_Alarm_Ring;
    FuncList.OnRestoreState = Cale_On_Create_Reminder_Alarm_Ring;

    pDesc = (UI_Normal_Reminder_Alarm_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_Reminder_Alarm_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_Reminder_Alarm_Desc_t));

    pDesc->ContImg.Img      = IMG_MENU_CALENDAR;
    pDesc->ContLabelR.TxtId = LV_LANG_TXT_ID_NONE;
    pDesc->ContLabelD.TxtId = LV_LANG_TXT_ID_NONE;

    pDesc->ButtonBar.ButtonL.Valid = FALSE;
    pDesc->ButtonBar.ButtonM.Valid = TRUE;
    pDesc->ButtonBar.ButtonM.TxtId = PHONE_TEXT_ID_POSTP;
    pDesc->ButtonBar.ButtonR.Valid = TRUE;
    pDesc->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_QUIT;

    pDesc->KeyFunc = Cale_Key_Proc_Reminder_Alarm_Ring;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_REMINDER_ALARM_RING, &FuncList, pDesc);
}

/**
 * display Calendar alarm postponed UI
 * common ui: UI_Status_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Alarm_Postponed(VOID)
{
    Display_Cale_Status(ACT_ID_CALENDAR_ALARM_POSTPONED);
}

/**
 * display Calendar reminder discarded UI
 * common ui: UI_Status_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Reminder_Discarded(VOID)
{
    Display_Cale_Status(ACT_ID_CALENDAR_REMINDER_DISCARDED);
}

/**
 * Process On Created event of add reminder memory full
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_Cale_Add_Reminder_Mem_Full(VOID *pDesc)
{
    g_CalendarMng.CurrentDesc = pDesc;
}

/**
 * display Calendar add reminder memory full UI
 * common ui: UI_Normal_NoTitle_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Add_Reminder_Memory_Full(VOID)
{
    Nav_Func_List_t          FuncList = { 0 };
    UI_Normal_NoTitle_Desc_t *pDesc;

    FuncList.OnShow         = UI_Normal_NoTitle_Create;
    FuncList.OnCreate       = Cale_On_Create_Cale_Add_Reminder_Mem_Full;
    FuncList.OnDestroy      = Cale_Common_Destory;
    FuncList.OnSaveState    = Cale_Common_Save;
    FuncList.OnRestoreState = Cale_Common_Restore;

    pDesc = (UI_Normal_NoTitle_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_NoTitle_Desc_t));
    Hal_Mem_Set(pDesc, 0, sizeof(UI_Normal_NoTitle_Desc_t));

    pDesc->ContenCont.ContLabel.TxtId       = PHONE_TEXT_ID_REMINDER_MEMORY_FULL;
    pDesc->ContenCont.ContLabel.SymbolId    = LV_SYMBOL_WARNING;
    pDesc->ContenCont.ContLabel.TxtAlign    = LV_LABEL_ALIGN_LEFT;
    pDesc->ContenCont.ContLabel.SymbolAlign = LV_LABEL_ALIGN_RIGHT;
    pDesc->ContenCont.ContLabel.LabelAlign  = LV_ALIGN_IN_TOP_LEFT;

    pDesc->ButtonBar.ButtonL.Valid = FALSE;
    pDesc->ButtonBar.ButtonM.Valid = TRUE;
    pDesc->ButtonBar.ButtonM.TxtId = PHONE_TEXT_ID_OK; /*open reminders to delete*/
    pDesc->ButtonBar.ButtonR.Valid = TRUE;
    pDesc->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    pDesc->KeyFunc = Cale_Key_Proc_Add_Reminder_Mem_Full;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_ADD_REMINDER_MEM_FULL, &FuncList, pDesc);
}

/**
 * Process On Created event of View All
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Create_View_All(VOID *pDesc)
{
    BOOL IsViewToday = FALSE; /*view all or memory full to delete for add reminder*/

    g_CalendarMng.CurrentDesc = pDesc;
    if (UI_CALE_PROCESS_VIEW_TODAY == g_CalendarMng.Process)
    {
        IsViewToday = TRUE;
    }
    g_CalendarMng.ReminderInOper = UI_Cale_Get_Next_Reminder(NULL, IsViewToday);
    UI_Cale_Display_Reminder((UI_Normal_Reminder_Desc_t *)pDesc,
                             g_CalendarMng.ReminderInOper,
                             IsViewToday);
}

/**
 * Process On restored event of View All
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Restore_View_All(VOID *pDesc)
{
    BOOL IsViewToday = FALSE; /*view all or memory full to delete for add reminder*/

    g_CalendarMng.CurrentDesc = pDesc;
    if (UI_CALE_PROCESS_VIEW_TODAY == g_CalendarMng.Process)
    {
        IsViewToday = TRUE;
    }
    UI_Cale_Display_Reminder((UI_Normal_Reminder_Desc_t *)pDesc,
                             g_CalendarMng.ReminderInOper,
                             IsViewToday);
}

/**
 * Process On destroyed event of View All
 * param (in) pDesc:  VOID *
 * return  void
 */
VOID Cale_On_Destroy_View_All(VOID *pDesc)
{
    if (UI_CALE_PROCESS_ADD_REMINDER != g_CalendarMng.Process)
    {
        g_CalendarMng.Process = UI_CALE_PROCESS_NULL;
    }
    g_CalendarMng.ReminderInOper = NULL;
    Cale_Common_Destory(pDesc);
}

/**
 * display Calendar view all UI
 * common ui: UI_Normal_Reminder_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_View_All(VOID)
{
    Nav_Func_List_t           FuncList = { 0 };
    UI_Normal_Reminder_Desc_t *pDesc;

    FuncList.OnShow         = UI_Normal_Reminder_Create;
    FuncList.OnCreate       = Cale_On_Create_View_All;
    FuncList.OnDestroy      = Cale_On_Destroy_View_All;
    FuncList.OnSaveState    = Cale_Common_Save;
    FuncList.OnRestoreState = Cale_On_Restore_View_All;

    pDesc = (UI_Normal_Reminder_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_Reminder_Desc_t));
    memset(pDesc, 0, sizeof(UI_Normal_Reminder_Desc_t));

    pDesc->TitleLabelL.TxtId    = LV_LANG_TXT_ID_NONE;
    pDesc->TitleLabelL.TxtAlign = LV_LABEL_ALIGN_LEFT;
    pDesc->TitleLabelR.TxtId    = LV_LANG_TXT_ID_NONE;
    pDesc->TitleLabelR.TxtAlign = LV_LABEL_ALIGN_RIGHT;

    pDesc->ContLabel.TxtId = LV_LANG_TXT_ID_NONE;

    if (UI_CALE_PROCESS_ADD_REMINDER != g_CalendarMng.Process)
    {/*view al or view today*/
        pDesc->ButtonCont.ButtonL.Valid = TRUE;
        pDesc->ButtonCont.ButtonL.TxtId = PHONE_TEXT_ID_EDIT;
    }
    else
    {
        pDesc->ButtonCont.ButtonL.Valid = FALSE;
    }
    pDesc->ButtonCont.ButtonM.Valid = TRUE;
    pDesc->ButtonCont.ButtonM.TxtId = PHONE_TEXT_ID_REMINDER_DELETE;
    pDesc->ButtonCont.ButtonR.Valid = TRUE;
    pDesc->ButtonCont.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    pDesc->KeyFunc = Cale_Key_Proc_View_All;
    Nav_Forward(ACT_ID_ANY, ACT_ID_CALENDAR_VIEW_ALL, &FuncList, pDesc);
}

/**
 * display Calendar reminder memory full to empty UI
 * common ui: UI_Status_Desc_t
 * param (in) void
 * return  void
 */
VOID Display_Calendar_Add_Reminder_Memory_Full_To_Empty(VOID)
{
    Display_Cale_Status(ACT_ID_CALENDAR_ADD_REMINDER_MEM_FULL_TO_EMPTY);
}
